/**
 * 项目所有相关 cookies 操作
 */

import Cookies from "js-cookie";
// 处理侧边栏打开关闭状态
const SIDE_BAR_KEY = 'cs-2201-sidebar-key'
export const setSidetbarStatus = (status) => { // 存 cookies
    Cookies.set(SIDE_BAR_KEY, status ? 1 : 0)
}

export const getSidetbarStatus = () => {  // 取 cookies
    let status = Cookies.get(SIDE_BAR_KEY)
    if (status && status == 1) {
        return true
    }
    return false
}

export const removeSidetbarStatus = () => { // 删除 cookies
    Cookies.remove(SIDE_BAR_KEY)
}
// 处理 token
const USER_TOKEN_KEY = 'cs-220107-token'
export const setToken = (token) => {
    Cookies.set(USER_TOKEN_KEY, token)
}
export const getToken = () => {
    return Cookies.get(USER_TOKEN_KEY)
}
export const removeToken = () => {
    return Cookies.remove(USER_TOKEN_KEY)
}